' Template Provided By
' Code Endeavors, LLC - http://www.codeendeavors.com

Imports DotNetNuke
Imports DotNetNuke.UI.Utilities

Namespace $YourCompany$.Modules.$safeprojectname$

    <ControlMethodClass("$YourCompany$.Modules.$safeprojectname$.View$safeprojectname$")> _
    Partial Class View$safeprojectname$
        Inherits SilverlightPortalModuleBase
        Implements Entities.Modules.IActionable

#Region "AjaxPortalModuleBase Events"
        '-------------------------------------------------------------------------------------------------------------
        '- This is where you add your custom properties that are to be sent down to the client-side object
        '- By default we are passing the naming container ID (ns) and localized messages (msgs) 
        '- If you add your own properties make sure you update your client code with those properties found in Edit$safeprojectname$.ascx.js
        '-      get_ImagePath: function() {return this._imagePath;},
        '-      set_ImagePath: function(value) {this._imagePath = value;},
        '-------------------------------------------------------------------------------------------------------------
        Protected Sub AjaxPortalModuleBase_AddScriptComponentDescriptors(ByVal Descriptor As ScriptComponentDescriptor) Handles MyBase.AddScriptComponentDescriptors
            'IMPORTANT!  Enter Client Namespace + ObjectName as Type
            Descriptor.Type = "$YourCompany$.View$safeprojectname$"

            '---------------------------------------------------------------------------------------------------------
            'Add custom properties here
            '   Descriptor.AddScriptProperty("ImagePath", String.Format("'{0}'", Me.ModulePath & "images/"))
            '---------------------------------------------------------------------------------------------------------
            If String.IsNullOrEmpty(Settings("MediaUrl")) = False Then
                Descriptor.AddScriptProperty("mediaUrl", String.Format("'{0}'", Settings("MediaUrl")))
            End If

        End Sub

        '-------------------------------------------------------------------------------------------------------------
        '- This is where your client-side javascript that uses the MS AJAX framework needs to be registered
        '- Adding the reference here ensures that the MS AJAX script is run before our script which uses things like Type.registerNamespace run
        '-------------------------------------------------------------------------------------------------------------
        Protected Sub AjaxPortalModuleBase_AddScriptReferences(ByVal References As List(Of ScriptReference)) Handles MyBase.AddScriptReferences
            References.Add(New System.Web.UI.ScriptReference(Me.ModulePath & "View$safeprojectname$.ascx.js"))
        End Sub

        '-------------------------------------------------------------------------------------------------------------
        '- Add any localized text needed on the client
        '-------------------------------------------------------------------------------------------------------------
        Protected Sub AjaxPortalModuleBase_AddLocalizedMessages(ByVal Messages As Dictionary(Of String, String)) Handles MyBase.AddLocalizedMessages
            Messages("btnPlay") = Localization.GetString("btnPlay.Client", LocalResourceFile)
            Messages("btnStop") = Localization.GetString("btnStop.Client", LocalResourceFile)
            Messages("btnPause") = Localization.GetString("btnPause.Client", LocalResourceFile)
            Messages("btnFullScreen") = Localization.GetString("btnFullScreen.Client", LocalResourceFile)
        End Sub

#End Region

#Region "Optional Interfaces"

        ' Registers the module actions required for interfacing with the portal framework
        Public ReadOnly Property ModuleActions() As Entities.Modules.Actions.ModuleActionCollection Implements Entities.Modules.IActionable.ModuleActions
            Get
                Dim Actions As New Entities.Modules.Actions.ModuleActionCollection
                Actions.Add(GetNextActionID, Localization.GetString("Edit.Text", LocalResourceFile), Entities.Modules.Actions.ModuleActionType.AddContent, "", "", EditUrl(), False, Security.SecurityAccessLevel.Edit, True, False)
                Return Actions
            End Get
        End Property

#End Region

    End Class

End Namespace
